<template>
  <el-dialog
    :visible.sync="dialogVisible"
    :title="title"
    width="800px"
    @callBack="onCallBack"
    @close="onClose"
  >
    <div class="app-container">
      <table class="tb-table">
        <tr>
          <td class="tb-title" width="20%">运单号:</td>
          <td colspan="3">{{ form.ydh }}</td>
        </tr>
        <tr>
          <td class="tb-title" width="20%">收件人:</td>
          <td colspan="3">{{ form.receiver }}</td>
        </tr>
        <tr>
          <td class="tb-title" width="20%">收件人公司:</td>
          <td colspan="3">{{ form.company }}</td>
        </tr>
        <tr>
          <td class="tb-title" width="20%">收件人地址:</td>
          <td colspan="3">{{ form.address }}</td>
        </tr>
        <tr>
          <td class="tb-title" width="20%">收件人电话:</td>
          <td colspan="3">{{ form.phone }}</td>
        </tr>
        <tr>
          <td class="tb-title" width="20%">支付方式:</td>
          <td colspan="3">
            <el-tag v-if="form.payMethod === '1'" size="mini">月结</el-tag>
            <el-tag v-if="form.payMethod === '2'" type="info" size="mini"
              >到付</el-tag
            >
          </td>
        </tr>
        <tr>
          <td class="tb-title" width="20%">金额:</td>
          <td colspan="3">{{ form.fee }}</td>
        </tr>
        <tr>
          <td class="tb-title" width="20%">操作人:</td>
          <td width="30%">
            {{ form.creatorName }}
          </td>
          <td class="tb-title" width="20%">创建时间:</td>
          <td width="30%">
            {{ form.createTime }}
          </td>
        </tr>
      </table>
    </div>
  </el-dialog>
</template>

<script>
import { getOne } from "@/api/sysExpress";

export default {
  data() {
    return {
      dialogVisible: false,
      title: "查看快递",
      form: {},
    };
  },
  methods: {
    init(id) {
      getOne(id).then((res) => {
        if (res.code === 20000) {
          this.form = res.data;
        }
      });
    },
    onShow(id) {
      this.init(id);
      this.dialogVisible = true;
    },
    onClose() {
      this.dialogVisible = false;
    },
    onCallBack() {
      this.$emit("onCallBack");
    },
  },
};
</script>

<style scoped>
.el-form {
  padding-left: 20px;
  padding-right: 20px;
}
</style>
